{extend name="$LAYOUT_SHOP_BASE" /}
{block name="css"}
<link href="__STATIC__/plugins/validator/jquery.validator.css?v={$v}" rel="stylesheet">
{/block}
{block name="main"}
<style>
input[type=text]{width:150px;}
</style>
<form id='grouponform' name='grouponform' autocomplete="off">
    <input type='hidden' id='grouponId' class='ipt' value='{$object["grouponId"]}'/>
    <table class="wst-form">
           <tr>
             <td colspan="2">
               <div class='wst-tips-box'>
               <div class='icon'></div>
               <div class='tips'>
               1.团购商品为实物商品时，团购数量和实物商品数量无关联；团购商品为虚拟商品时请确保虚拟商品有足够的库存。<br/>2.若团购为多规格商品的话，则取推荐的规格为团购商品的规格。<br/>3.正在团购中的商品如果有修改的话，则该团购商品则需要重新审核。</div>
               <div style="clear:both"></div>
               </div>
             </td>
           </tr>
           <tr>
             <th width='120' align='right'>&nbsp;</th>
             <td>
             	<select id="shopCatId1" class='j-ipt' onchange="getShopsCats('shopCatId2',this.value,'');">
                 <option value="">-请选择-</option>
                 {volist name=":WSTShopCats(0)" id="vo"}
                 <option value="{$vo['catId']}">{$vo['catName']}</option>
                 {/volist}
              </select>
              <select id='shopCatId2' class='j-ipt'>
                 <option value=''>请选择</option>
              </select>
			    <br/>
             	<input type='text' id='goodsName' style='margin-top:5px;' placeholder="请输入要搜索的商品名称" />
             	<a type="button" class='btn btn-primary' onclick="searchGoods()"><i class="fa fa-search"></i>查&nbsp;询</a>
             </td>
           </tr>
           {if $object['grouponStatus']==-1}
           <tr class="wst-order-rate" >
               <th width='120'>不通过原因：</th>
             <td colspan='3' style='color:red'>
                 {$object['illegalRemarks']}
             </td>
           </tr>
           {/if}
           <tr>
             <th width='120' align='right'>团购商品：</th>
             <td>
             	<select id='goodsId' class='ipt' onchange='changeGoods(this)'>
                <option value="{$object['goodsId']}">{$object['goodsName']}</option>
              </select><br/>
             </td>
           </tr>
           <tr>
               <th width='120'>市场价格：</th>
	             <td colspan='3' id='marketPrice'>￥{$object["marketPrice"]}</td>
           </tr>
           <tr class="wst-order-rate" >
               <th width='120'>团购价格：</th>
	           <td colspan='3'>
	               <input type='text' id='grouponPrice' name='grouponPrice'class='ipt' maxLength='10' value='{$object["grouponPrice"]}' data-rule='团购价格:required;price' data-rule-price="[/^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$/, '价格必须大于0']"/>
	           </td>
           </tr>
           <tr class="wst-order-rate" >
               <th width='120'>团购数量：</th>
	           <td colspan='3'>
	               <input type='text' id='grouponNum' name='grouponNum' class='ipt' maxLength='8' data-rule='团购数量:required;integer[+]' value='{$object["grouponNum"]}'/>
	           </td>
           </tr>
            <tr class="wst-order-rate" >
                <th width='120'>每人最多可团数量：</th>
                <td colspan='3'>
                    <input type='text' id='limitNum' name='limitNum' class='ipt' maxLength='8' data-rule='每人最多可团:required;integer[+]' value='{$object["limitNum"]}'/>
                </td>
            </tr>
           <tr class="wst-order-rate" >
               <th width='120'>团购时间：</th>
	           <td colspan='3'>
	               <input type='text' id='startTime' name='startTime' class='ipt laydate-icon' value='{$object["startTime"]}' onclick="laydate({format: 'YYYY-MM-DD hh:mm:ss',istime:true})"  data-rule="开始日期: required;datetime;"/>
	               至
                   <input type='text' id='endTime' name='endTime' class='ipt laydate-icon' value='{$object["endTime"]}' onclick="laydate({format: 'YYYY-MM-DD hh:mm:ss',istime:true})" data-rule="结束日期: required;datetime;match(gt, startTime, datetime)"/>
 	           </td>
           </tr>
           <tr class="wst-order-rate" >
               <th width='120'>团购说明：</th>
	           <td colspan='3'>
	               <textarea id='grouponDesc' class='ipt' style='width:70%;height:150px;'>{$object["grouponDesc"]}</textarea>
	           </td>
           </tr>
           <tr>
             <td colspan='2' style='text-align:center;padding:20px;'>
                 <button class='btn btn-primary' type='button' onclick="save({$p})"><i class="fa fa-check"></i>保&nbsp;存</button>&nbsp;&nbsp;
                 <button class='btn' type='button' onclick="javascript:location.href = WST.AU('groupon://shops/groupon','p={$p}')"><i class="fa fa-angle-double-left"></i>返&nbsp;回</button>
             </td>
           </tr>
        </table>
  </form>
{/block}  
{block name="js"}
<script type="text/javascript" src="__STATIC__/plugins/validator/jquery.validator.min.js?v={$v}"></script>
<script type="text/javascript" src="__ROOT__/addons/groupon/view/shop/shop.js?v={$v}"></script>
<script>
$(function(){
  var laydate = layui.laydate;
  laydate.render({
      elem: '#startTime',
      type: 'datetime'
  });
  laydate.render({
      elem: '#endTime',
      type: 'datetime'
  });
})
</script>
{/block}